package _base0to1;

/**
 * 657. 机器人能否返回原点
 */
public class No657 {
    public boolean judgeCircle(String moves) {
        int[] opts = new int[4];
        for (char c : moves.toCharArray()) {
            opts[switch (c) {
                case 'U' -> 0;
                case 'D' -> 1;
                case 'L' -> 2;
                default -> 3;
            }]++;
        }
        return opts[0] == opts[1] && opts[2] == opts[3];
    }
}
